package com.lm.jwt.service;

import org.springframework.security.core.userdetails.*;
import org.springframework.stereotype.Service;


@Service
public class MyUserDetailsService implements UserDetailsService {

    @Override
    public UserDetails loadUserByUsername(String username) {
        if (!"admin".equals(username)) {
            throw new UsernameNotFoundException("用户不存在");
        }

        return User.withUsername("admin")
                .password("{noop}123456") // 无加密示例
                .authorities("ROLE_ADMIN")
                .build();
    }
}
